# -*- coding: utf-8 -*-
from scpy.logger import get_logger
import os
import sys
import tornado.ioloop
import tornado.web
from handler import *
reload(sys)
sys.setdefaultencoding('utf-8')

logger = get_logger(__file__)

CURRENT_PATH = os.path.dirname(__file__)
if CURRENT_PATH:
    CURRENT_PATH = CURRENT_PATH + "/"



HandlerList = [
    (r"/test", MainHandler),
    (r"/test/template",TemplateHandler),
    (r"/test/index",TestHandler),
]


templatePath = os.path.join(os.path.dirname(__file__), "template")
staticPath = os.path.join(os.path.dirname(__file__), "static")

if __name__ == '__main__':
    application = tornado.web.Application(HandlerList,template_path=templatePath,\
                                          static_path=staticPath)
    serverPort = 8000
    application.listen(serverPort)
    logger.info('server start at port %d'%serverPort
                )
    tornado.ioloop.IOLoop.instance().start()